<link rel="stylesheet" href="templates/authority/common/css/zTreeStyle.css"/>
<link rel="stylesheet" href="templates/authority/qxgl/css/qxgl.css"/>
<div class="pd14 vany_authority">
    <div class="vany_treeTable pd14" id="jurisdiction">
        <!--面包屑-->
        <div class="pb10" id="crumbs">
            <el-breadcrumb separator-class="el-icon-arrow-right">
                <el-breadcrumb-item :to="{ path: '/' }">组织权限</el-breadcrumb-item>
                <el-breadcrumb-item>权限管理</el-breadcrumb-item>
            </el-breadcrumb>
            <i-favorite></i-favorite>
        </div>
        <div id="qxgl">
            <div class="pd14">
                <el-row :gutter="8">
                    <el-col :span="12">
                        <el-row :gutter="8">
                            <el-col :span="12">
                                <el-input placeholder="请输入您要搜索的内容" icon="search" v-model="page.condition.roleName"></el-input>
                            </el-col>
                            <el-col :span="4">
                                <el-dropdown @command="filterStatus" style="margin-top: 2px;">
                                    <el-button type="primary">
                                        {{curFilter}}<i class="el-icon-caret-bottom el-icon--right"></i>
                                    </el-button>
                                    <el-dropdown-menu slot="dropdown">
                                        <el-dropdown-item v-for="(item,index) in filtersStatusCount" :key="index" :command="item.value">{{item.text}}</el-dropdown-item>
                                    </el-dropdown-menu>
                                </el-dropdown>
                            </el-col>
                        </el-row>
                    </el-col>
                    <el-col :span="12">
                        <el-row type="flex" class="row-bg qxBtn" justify="end">
                            <el-button type="primary" @click="showAddRole" authority="base_role_addRole">新增角色</el-button>
                            <el-button type="danger" @click="remove" authority="base_role_deleteRole">批量删除</el-button>
                        </el-row>
                    </el-col>
                </el-row>
            </div>

            <el-table ref="table" :data="page.records" v-loading="listLoading" highlight-current-row :height="tableHeight" @selection-change="handleSelectionChange">
                <el-table-column type="selection" :selectable="selectable"></el-table-column>
                <el-table-column type="index" label="编号" width="80px"></el-table-column>
                <el-table-column prop="roleName" show-overflow-tooltip label="角色名称"></el-table-column>
                <el-table-column prop="description" show-overflow-tooltip label="角色描述"></el-table-column>
                <el-table-column prop="owner" show-overflow-tooltip label="创建人"></el-table-column>
                <el-table-column label="操作" min-width="150px">
                    <template scope="scope">
                        <div class="qxBtn">
                            <el-button v-if="!scope.row.isAdmin" type="text" @click="showRoleFunctionTree(scope.row)" authority="base_role_modifyRFAAndRemove">分配功能权限</el-button>
                            <span v-if="!scope.row.isAdmin" class="split_btn">|</span>
                            <!--
                             <el-button type="text" @click="showRoleDataTree(scope.row)" authority="base_role_modifyRDAAndRemove">分配数据权限<span class="split_btn">|</span></el-button>
                             -->
                            <el-button type="text" @click="rolePerson(scope.row)" authority="showOk">查看人员</el-button>
                            <span v-if="!scope.row.isDefault" class="split_btn">|</span>
                            <el-button v-if="!scope.row.isDefault" type="text" @click="editRole(scope.$index, scope.row)" authority="base_role_modifyRoleInfo">编辑</el-button>
                            <span v-if="!scope.row.isDefault" class="split_btn">|</span>
                            <el-button v-if="!scope.row.isDefault" type="text" @click="deleteRole(scope.row.roleId)" authority="base_role_deleteRole" style="color:#ff0000;">删除</el-button>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column column-key="isEnable" show-overflow-tooltip label="状态">
                    <template scope="scope">
                        <div v-if="scope.row.isEnable === '1'">
                            启用
                        </div>
                        <div v-else>
                            <div style="color:#ff0000;">禁用</div>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
            <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="page.current"
                    :page-sizes="[10, 20, 30]"
                    :page-size="page.size"
                    :total="page.total"
                    layout="total, sizes, prev, pager, next, jumper">
            </el-pagination>
        </div>
    </div>
</div>
<!-- ******************************************************************************角色有关开始****************************************************************************** -->
<!--添加角色-->
<div id="addRole">
    <el-dialog v-model="treeAddVisible" :title="title" :close-on-click-modal="false" size="small" custom-class="border_dialog title_dialog" @close="resetForm('roleForm')">
        <el-form :label-position="labelPosition" :model="roleForm" :rules="rules" ref="roleForm" label-width="100px">
            <el-form-item label="角色名称" required prop="roleName">
                <el-input v-model="roleForm.roleName" placeholder="请输入角色名称"></el-input>
            </el-form-item>
            <el-form-item label="角色描述" prop="description">
                <el-input type="textarea" placeholder="请输入角色描述" v-model="roleForm.description"></el-input>
            </el-form-item>
            <el-form-item label="状态" v-if="isEditAdmin">
                <el-radio-group v-model="roleForm.isEnable">
                    <el-radio :label="1">启用</el-radio>
                    <el-radio :label="0">禁用</el-radio>
                </el-radio-group>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button class="loading" type="primary" @click="submitForm('roleForm', $event)" v-if="isEdit">修改</el-button>
            <el-button class="loading" type="primary" @click="submitForm('roleForm', $event)" v-else>确定</el-button>
            <el-button class="el-button--ddd" @click="hide">取消</el-button>
        </div>
    </el-dialog>
</div>

<!--角色人员-->
<div id="rolePerson">
    <el-dialog title="角色人员" v-model="rolePersonVisible" custom-class="border_dialog title_dialog" @close="handleClose" :close-on-click-modal="false">
        <p style="font-size: 16px; margin-bottom: 10px;">当前角色：<span style="color: #f00;" v-text="curRoleName"></span></p>
        <el-row :gutter="20">
            <el-col :span="16">
                <el-input @input.native="restore" @keyup.enter.native="filterTable" placeholder="请输入您要搜索的内容" icon="search" v-model="params.condition.searchKey"></el-input>
            </el-col>
            <el-col :span="8" class="qxBtn">
                <el-button type="primary" @click="openPersonFilter" authority="base_role_modifyRoleUser">增加人员</el-button>
                <el-button type="primary" @click="remove" authority="base_role_deleteRoleUser">批量移除</el-button>
            </el-col>
        </el-row>
        <p style="margin:10px 0 30px 0;"></p>
        <el-table :height="height" :data="tableData" @selection-change="selsChange" ref="table">
            <el-table-column type="selection" :selectable="selectable" width="50"></el-table-column>
            <el-table-column property="username" label="学工号"></el-table-column>
            <el-table-column property="chineseName" label="姓名"></el-table-column>
            <!--<el-table-column property="genderStr" label="性别"></el-table-column>-->
            <el-table-column property="department" label="部门" show-overflow-tooltip></el-table-column>
        </el-table>
    </el-dialog>
</div>

<!-- 角色功能权限树  -->
<div id="roleFunctionTree">
    <el-dialog id="roleFunctionTree" title="分配功能权限" size="small" v-model="visible" custom-class="border_dialog title_dialog" :close-on-click-modal="false">
        <div id="roleFunctionTreeContainer">
            <el-input placeholder="输入关键字进行过滤" v-model="filterText"></el-input>
            <p style="margin-bottom: 10px;"></p>
            <el-tree class="filter-tree" :data="treeData" :props="defaultProps" default-expand-all show-checkbox node-key="id" :filter-node-method="filterNode"
                     :style="style" ref="tree">
            </el-tree>
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="save">确定</el-button>
            <el-button class="el-button--ddd" @click="hide">取消</el-button>
        </div>
    </el-dialog>
</div>

<!-- 角色数据权限树  -->
<div id="roleDataTree">
    <el-dialog title="分配数据权限" size="small" v-model="visible" custom-class="border_dialog title_dialog" :close-on-click-modal="false">
        <div id="roleDataTreeContainer">
            <el-input placeholder="输入关键字进行过滤" v-model="filterText"></el-input>
            <p style="margin-bottom: 10px;"></p>
            <el-tree class="filter-tree" :data="treeData" :props="defaultProps" default-expand-all show-checkbox node-key="orgCode" :filter-node-method="filterNode" :style="style"
                     ref="tree">
            </el-tree>
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="save">确定</el-button>
            <el-button class="el-button--ddd" @click="hide">取消</el-button>
        </div>
    </el-dialog>
</div>
<!-- ******************************************************************************角色有关结束****************************************************************************** -->
<script type="text/javascript" src="templates/authority/qxgl/js/qxgl_role.js"></script>
<script type="text/javascript" src="templates/authority/qxgl/js/qxgl.js"></script>